<template>
  <div class="mainbody">
    <div class="head">
           <div class="elBtns">
        <el-button
          circle
          class="el-icon-switch-button"
          size="default"
          @click="destroy"
        ></el-button>
      </div>
      <h4>企业基本信息：</h4>
      <div class="message">
        <ul class="left">
          <li><p>企业名称：{{list.name}}</p></li>
          <li><p>企业性质：{{list.nature}}</p></li>
          <li><p>企业类型：{{list.type}}</p></li>
          <li><p>企业法人：{{list.legalperson}}</p></li>
          <li><p>企业电话：{{list.tel}}</p></li>
        </ul>
        <ul class="right">
          <li><p>企业地址：{{list.address}}</p></li>
          <li><p>注册资本：{{list.capital}}</p></li>
          <li><p>企业注册时间：{{list.time}}</p></li>

          <li><p>统一社会信用编码：{{list.code}}</p></li>
        </ul>
      </div>
    </div>
    <div>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list:[]
    }
  },
  methods: {
       destroy() {
      this.$confirm("是否注销当前账号?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$router.push({
            name: "index",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    async init(){
      let result= await this.$http.get('/data/company.json');
      // console.log(result.data);
      this.list=result.data;
      // console.log(this.list.name);
      this.bus.$emit('name',this.list.name)
      console.log(this.bus.$emit('name',this.list.name));
    }
  },
  created() {
    this.init();
   
  },
  mounted() {
     
    

  },
};
</script>

<style>
h4 {
  margin: 0px;
}
.mainbody{
  border: 2px solid #E8EDF0;
}
.head {
  background-color: #E8EDF0;
  padding: 10px;
}
.message {
  display: flex;
  font-size: 14px;
}
.left {
  width: 50%;
}
.elBtns .el-button {
  float: right;
  margin-top: 8px;
  margin-right: 8px;
}
</style>